#pragma once


#ifdef __cplusplus
extern "C" {
#endif
#include "esp_wifi.h"
#include "lvgl.h"
#include "lv_port_disp.h"
#include "lv_port_indev.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"


#ifdef   VAR_PAGE_GLOBALS
#define  VAR_PAGE_EXT
#else
#define  VAR_PAGE_EXT  extern
#endif
typedef void (*lv_page_show)(void);
typedef void (*lv_page_quit)(void);

typedef struct page
{
    lv_obj_t* page;
    lv_page_show show;
    lv_page_quit quit;
};
typedef struct page * page_t;
typedef struct led_bar
{
    lv_style_t style_bg;
    lv_style_t style_indic;
    lv_obj_t *bar;
    lv_obj_t *led;
    lv_obj_t *label;
} __led_bar;
typedef struct led_bar *led_bar_t;

VAR_PAGE_EXT struct page msgboxPage;
VAR_PAGE_EXT struct page mainPage;
VAR_PAGE_EXT struct page waitPage;
VAR_PAGE_EXT struct page ledPage;
VAR_PAGE_EXT struct page mp3Page;
VAR_PAGE_EXT struct page weatherPage;
VAR_PAGE_EXT struct page calendarPage;
VAR_PAGE_EXT lv_group_t *group;
VAR_PAGE_EXT struct led_bar bar_r;
VAR_PAGE_EXT struct led_bar bar_g;
VAR_PAGE_EXT struct led_bar bar_b;

int push_page(page_t e);
page_t pop_page();
page_t get_top_page();
void page_init();
void page_show_pre();
void show_smart_config_ok();
void show_smart_config_wait();
void show_smart_config_fail();

void lv_thread();



#ifdef __cplusplus
}
#endif